package com.wangshidai.controller;

import com.wangshidai.entity.R;
import com.wangshidai.service.SysPermissionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Slf4j
@RestController
@Api(tags = "权限操作接口")
@RequestMapping("/permission")
public class PermissionController {
    @Autowired
    private SysPermissionService sysPermissionService;
    @ApiOperation("查询所有权限并标识角色已有权限")
    @GetMapping("/queryPermissionTree/{roleId}")
    public R queryPermissionTree(@PathVariable @ApiParam("角色id") long roleId) {
        log.info("接收到前端查询权限请求，参数{}",roleId);
        return  new R(200,"查询成功",sysPermissionService.queryPermissionTree(roleId));
    }
}
